const xss = require('xss');
console.log('xss.escapeAttrValue:', xss.escapeAttrValue.toString());

const options = {
    whiteList: { a: ['href', 'title'], i: [] },
    // stripIgnoreTag: true,
    allowCommentTag: false,
    onTagAttr(tag, name, value, isWhiteAttr) {
        console.log('onTagAttr:', tag, name, value, isWhiteAttr);
    },
    safeAttrValue(tag, name, value) {
        console.log('safeAttrValue:', tag, name, value);
        return '42';
    },
    onIgnoreTagAttr(tag, name, value, isWhiteAttr) {
        console.log('onIgnoreTagAttr:', tag, name, value, isWhiteAttr);
    },
};

const raw = `<a href="#" title="Hello world" onclick="alert(/xss/)">Click <i>me</i></a>
    code:<script>alert(/xss/)</script>
    code: <!-- Something --> END
`;
console.log('raw:', raw);
console.log(xss(raw, options));
